<!DOCTYPE html>
 <html>
 <head>
 <meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
 <% include("/view/console/common/css.html"){}	%>

 <title></title>
 </head>
 <body>
 <div class="zq-form">
 <form name="appVersion_form"  id="appVersion_form" class="form-horizontal" style="margin-bottom: 70px;">
   <div class="form-group" >
 <label class="col-sm-2 col-xs-2 control-label">版本描述</label>
 <div class="col-sm-6 col-xs-6">
 <input  type="text"  name="versionDescription" id="versionDescription" class="form-control" check-type="required" value='${appVersion.versionDescription!}' >
 </div>
  </div>
 <div class="form-group" >
 <label class="col-sm-2 col-xs-2 control-label">版本号</label>
 <div class="col-sm-6 col-xs-6">
 <input  type="text"  name="versionCode" id="versionCode" class="form-control" check-type="required" value='${appVersion.versionCode!}' >
 </div>
  </div>
  <div class="form-group" >
 <label class="col-sm-2 control-label">更新地址</label>
 <div class="col-sm-3">
   <span class="btn btn-success fileinput-button">
        <i class="glyphicon glyphicon-plus"></i>
        <span>添加</span>
  <input type="file" id="fileAddress_file" class="form-control" value='${appVersion.fileAddress!}' >
  <input type="hidden" id="fileAddress"  name="fileAddress"class="form-control" value='${appVersion.fileAddress!}' >
    </span>
  <div id="fileAddress_progress" class="progress">
   <div class="progress-bar progress-bar-success"></div>
  </div>
  </div>
   	<div class="col-sm-4">
   		<a id="fileAddress_file_show" href="${appVersion.fileAddress!}" style="width:100px;" >${appVersion.fileAddress!}</a>
 </div>
 </div>

   <script type="text/javascript"> 
 </script>
   <input type='hidden' name='id' id='id' value='${appVersion.id!}'><input type='hidden' name='common_token' id='common_token' value='${common_token!}'>
 </form>
  <nav class="navbar navbar-default navbar-fixed-bottom" style="text-align: right">
    <a href="#" class="btn btn-success" style="margin:10px"  onclick='saveZqForm()'>保存 </a>
  </nav>
 </div>
 <% include("/view/console/common/js.html"){} 	%>
 <script>
   var fileSize;
     layui.use(['layer','laydate'], function(){

     });
     $(function($) {
      /*开启表单验证*/
         $("#appVersion_form").validation();
       consoleUploadAliFile('fileAddress','',function (file) {
           fileSize=file.fileSize;
       });

     });
     /*保存*/
     function saveZqForm(){
         if ($("#appVersion_form").valid() == false) {
             return false;
         }
         var formObject=new Object();
         formObject.versionDescription=$('#versionDescription').val()==''?null:$('#versionDescription').val();
         formObject.versionCode=$('#versionCode').val()==''?null:$('#versionCode').val();
         formObject.fileAddress=$('#fileAddress').val()==''?null:$('#fileAddress').val();
         formObject.fileSize=fileSize;
         formObject.id=$('#id').val()==''?null:$('#id').val();

         var formObjectJson = JSON.stringify(formObject);
         zqPost("/console/app_version/save",
             {
                 formObjectJson :formObjectJson,
                 common_token :$("#common_token").val()
             }, function(data) {
                 layer.alert(data.message, {skin: 'layui-layer-molv',closeBtn: 0 }, function(){
                     parent.$("#appVersion").bootstrapTable("refresh");
                     parent.layer.closeAll();
                 });

             });
     }
 </script>
 <script type='text/javascript' src='/view/console/appVersion/appVersionForm.js'></script>
 </body>
